﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LEET.CommonInterfaces.Automation;
using LEET.CommonInterfaces.Models;
using System.Windows.Automation;
using Compiled_Tests.AutomationAbstractions;
using Tedds_Tool.Automatables;
using Tedds_Tool.Instructions;

namespace LEET.Recording
{
    class CollectsVerifications : IWidgetVisitor
    {
        private IObservableWidget root;

        public CollectsVerifications(IObservableWidget widget)
        {
            this.root = widget;
            Verifies = new List<IInstruction>();
        }

        public void Visit(IObservableWidget widget)
        {
            if (widget.HasPattern(ValuePattern.Pattern))
            {
                IUIPath path = widget.GetUIAHierarchy(root);
                String value = widget.Value;
                Verifies.Add(new Verify(new String[] { "VERIFY", "ELEMENT", "ValuePattern", path.ToString(), ".Current.Value", "Is", value  }, new List<ILEETHackModual>()));
            }
        }

        public List<IInstruction> Verifies { get; set; }
    }
}
